import { defineStore } from 'pinia'
import { ref } from 'vue'
//import { userGetHistoryNewsService } from '@/api/news'
//用户模块token setToken removeToken
export const usePrivateNewsStore = defineStore('privateNews', () => {
  const privateNewsList = ref([])

  const initPrivateNewsList = (list) => {
    //const history = await userGetHistoryNewsService()
    //newsList.value = history.data.data
    //newsList.value = userGetHistoryNews()
    privateNewsList.value = list
    console.log('初始化以后的【私聊】列表')
    console.log(privateNewsList.value)
  }
  const addPrivateNews = (news) => {
    console.log('加之前的【私聊】历史记录是：')
    console.log(privateNewsList.value)
    privateNewsList.value.push(news)
    console.log('现在的【私聊】历史记录是：')
    console.log(privateNewsList.value)
  }
  return {
    privateNewsList,
    initPrivateNewsList,
    addPrivateNews
  }
})
